package errors

/**
* @api {post} /db 数据库类型错误
* @apiGroup ErrorCode
* @apiVersion 1.0.0
* @apiDescription 	mongodb类型错误(111)
					xorm类型错误(120)

* @apiError 11100 mongodb查询出错
* @apiError 11101 mongodb更新数据出错
* @apiError 11102 mongodb查询参数异常
* @apiError 11103 mongodb之aggregate查询出错

* @apiError 12000 xorm查询出错
* @apiError 12001 xorm更新数据出错
* @apiError 12002 xorm查询参数异常
* @apiError 12003 xorm之aggregate查询出错
*/

// ---------------------------------------- mgo ------------------------------------------
func MgoSearchErr(obj... interface{})  error{
	return Exception{nil,11100,"mongodb查询出错",obj}
}

func MgoUpdateErr(obj... interface{})  error{
	return Exception{nil,11101,"mongodb更新数据出错",obj}
}

func MgoQueryParamErr(obj... interface{})  error{
	return Exception{nil,11102,"mongodb查询参数异常",obj}
}

func MgoAggregateSearchErr(obj... interface{})  error{
	return Exception{nil,11103,"mongodb aggregate查询出错",obj}
}

func MgoInsertErr(obj... interface{})  error{
	return Exception{nil,11103,"mongodb 插入or批量插入失败",obj}
}

// -------------------------------------- xorm ---------------------------------------

func XormSearchErr(obj... interface{})  error{
	return Exception{nil,12000,"xorm查询出错",obj}
}

func XormUpdateErr(obj... interface{})  error{
	return Exception{nil,12001,"xorm更新数据出错",obj}
}

func XormQueryParamErr(obj... interface{})  error{
	return Exception{nil,12002,"xorm查询参数异常",obj}
}

func XormAggregateSearchErr(obj... interface{})  error{
	return Exception{nil,12003,"xorm aggregate查询出错",obj}
}

func XormInsertErr(obj... interface{})  error{
	return Exception{nil,12003,"xorm 插入or批量插入失败",obj}
}